package com.demo.schedule;
import com.demo.dao.UserDao;
import com.demo.config.DatabaseConnection;
import java.sql.Connection;

public class UserCleanupTask extends BaseTask {
  // 清理超过30天的未激活用户
  private static final int INACTIVE_DAYS = 30;

  public UserCleanupTask() {
    super("用户清理任务");
  }

  @Override
  protected void executeTask() throws Exception {
    try (Connection conn = DatabaseConnection.getConnection()) {
      UserDao userDao = new UserDao();
      int deletedCount = userDao.deleteInactiveUsers(conn, INACTIVE_DAYS);

      System.out.println("清理了 " + deletedCount + " 个超过 "
          + INACTIVE_DAYS + " 天未激活的用户");
    }
  }
}